[tool] Improve check version ci so that it enforces the version in CHANGELOG and pubspec matches.#3678
Conversation
script/check_version.sh
Outdated
There was a problem hiding this comment.
This needs to be moved into the if block below before merging
script/check_version.sh
Outdated
There was a problem hiding this comment.
Yes, before merging, ill move the check into this if block so pre-submit only checks version for changed packages. (also add a block to run everything when on master
There was a problem hiding this comment.
Same; I would much rather this be Dart.
| if (pubspec.publishTo == 'none') { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
this can be handy if a plugin is a WIP state.
There was a problem hiding this comment.
this makes testing very hard, because in testing, pubspecs are all created with publishTo = none. See: https://github.com/flutter/plugins/blob/master/script/tool/test/util.dart#L154-L156
So this check basically made tests imposable if we want to test with a pubspec that contains versions.
I was thinking even for WIP plugins, it is still ok to check to see if versions match.
There was a problem hiding this comment.
Couldn't we change that test safeguard from none to some made up pub server that doesn't exist, so it wouldn't clash with real none entries?
.cirrus.yml
Outdated
There was a problem hiding this comment.
Let's fold this into the publishable task a new script line. There's some overhead to each job we spin up, and this is conceptually part of publishable IMO.
script/check_version.sh
Outdated
There was a problem hiding this comment.
Can't we do this in Dart so we're not adding more logic to shell scripts that we need to deal with?
script/check_version.sh
Outdated
There was a problem hiding this comment.
Same; I would much rather this be Dart.
script/tool/lib/src/common.dart
Outdated
There was a problem hiding this comment.
s/Throws/Throw/; this name sounds like a test function to validate that something throws a ToolExit.
There was a problem hiding this comment.
done. Renamed it as PrintErrorAndExit
| if (pubspec.publishTo == 'none') { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Couldn't we change that test safeguard from none to some made up pub server that doesn't exist, so it wouldn't clash with real none entries?
There was a problem hiding this comment.
We should probably skip blank lines.
There was a problem hiding this comment.
Please print the two versions here for debugging if there are issues (e.g., if some accidentally put something after the version on the CHANGELOG line, it might not be obvious why this fails)
There was a problem hiding this comment.
Isn't this a real bug you're suppressing, since you're only handling Exception?
There was a problem hiding this comment.
Why do we want to do this? Isn't an empty first line a harmless cosmetic thing that we should just ignore?
| ]), | ||
| ); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Please include a test where the version matches an older entry in the CHANGELOG (an actual bug that's happened).
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Looking good, just some small things left. Yay for less logic in bash! (And a clear path to migrate some of our other bash easily.)
.cirrus.yml
Outdated
There was a problem hiding this comment.
Isn't this just $CIRRUS_BRANCH?
script/tool/lib/src/common.dart
Outdated
There was a problem hiding this comment.
changedFilesCommand.stdout.toString() is used three times; let's make it a local variable. (You could avoid the early return and its two checks by just setting that string with an ?? '' and then proceeding; an empty string fed to the logic below should give you an empty list).
script/tool/lib/src/common.dart
Outdated
There was a problem hiding this comment.
s/the version/the latest version/
script/tool/lib/src/common.dart
Outdated
There was a problem hiding this comment.
Why is this Print rather than print?
There was a problem hiding this comment.
Haha, it is probably caused by context switching between CPP and dart. Will fix
There was a problem hiding this comment.
How about just:
if ((iterator.current as String).trim()?.isNotEmpty == true) { ... }
?
There was a problem hiding this comment.
This path isn't printing what it found and tried to parse (related to previous review comment).
cyanglaz
left a comment
There was a problem hiding this comment.
updated based on your review, PTAL @stuartmorgan
script/tool/lib/src/common.dart
Outdated
There was a problem hiding this comment.
Haha, it is probably caused by context switching between CPP and dart. Will fix
script/tool/lib/src/common.dart
Outdated
script/tool/lib/src/common.dart
Outdated
…on in CHANGELOG and pubspec matches. (flutter/plugins#3678)
…on in CHANGELOG and pubspec matches. (flutter/plugins#3678) (#77854)
* master: (49 commits) Prep for alignment with Flutter analysis options (flutter#3703) [google_maps_flutter_platform_interface] Mark constructors as const for ids (flutter#3718) [image_picker] Endorse image_picker_for_web (flutter#3717) Add missing licenses, and add a check (flutter#3720) [ci] Add libgcrypt to Docker image. (flutter#3711) Reorder the checkboxes in the PR template (flutter#3666) Re-endorse connectivity_for_web (flutter#3708) Fix missing declaration of windows' default_package (flutter#3705) Typos in comments (flutter#2846) Skip flutter upgrade for pod linting Cirrus task (flutter#3700) [cross_file] Delete. (flutter#3698) [tool] Improve check version ci so that it enforces the version in CHANGELOG and pubspec matches. (flutter#3678) Streamline CI setup, and reenable macOS credits (flutter#3697) [video_player] fixed misleading size and aspect ratio documentation (flutter#3668) [image_picker] Implemented 2860 and added Unit Test to test functionality (flutter#3685) [shared_preferences] Fix concurrent modification of the shared preferences on Android (flutter#3684) [extension_google_sign_in_as_googleapis_auth] Deleted. (flutter#3694) Skip pod lint tests (flutter#3692) [Video_Player] Remove the deprecated API reference. (flutter#3669) [google_sign_in] fix test(flutter#3690) ...
check version ci always make sure the version in CHANGELOG and pubspec matches for all the plugins.
Fixes flutter/flutter#77067
Pre-launch Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.